<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>商品详细信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="./lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="./lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="./css/public.css" media="all">
</head>
<body style="background-color:#F6F6F6;">
<div class="layui-container">
	<div class="">
		<div style="text-align: right;">
			加入我们！<a href="#" id="register" style="color: #1986d4;"><span class="glyphicon glyphicon-user"></span>点击注册</a>
		</div>
	</div>
	<div class="layui-carousel" id="test1">
	  <div carousel-item>
		<div style="background: url(./images/lunbo/1.jpeg);background-repeat: no-repeat;background-size: 100% 100%;-moz-background-size: 100% 100%"></div>
		<div style="background: url(./images/lunbo/2.jpeg);background-repeat: no-repeat;background-size: 100% 100%;-moz-background-size: 100% 100%"></div>
		<div style="background: url(./images/lunbo/3.jpeg);background-repeat: no-repeat;background-size: 100% 100%;-moz-background-size: 100% 100%"></div>
	  </div>
	</div>
	<div class="layui-row layui-anim layui-anim-scale" style="margin-top: 1%;background-color:#dddddd;padding-top: 1%;margin-top: 3%;border-radius:7px;">		
		<h2 style="padding-left: 3%;">产品信息</h2><hr/>
		<div class="layui-col-md3 layui-col-md-offset1">
			<h2>商品id   ：</h2><h2 id="pid"></h2><br/>
			<h2>商品类别 ：</h2><h2 id="ptype"></h2> <br/>
			<h2>商品名称 ：</h2><h2 id="pname"> </h2><br/>
			<h2>原产地   ：</h2><h2 id="production"> </h2><br/>
			<h2>目的地   ：</h2><h2 id="destination"></h2>	<br/>		
		</div>
		<div class="layui-col-md3 layui-col-md-offset1">
			<h2>采摘时间 ：</h2><h2 id="picking"> </h2><br/>
			<h2>发货时间 ：</h2><h2 id="shipping"></h2><br/>
			<h2>收货时间 ：</h2><h2 id="receiving"></h2><br/>
			<h2>保质期   ：</h2><h2 id="validity"></h2><br/>
			<h2>建议售价 ：</h2><h2 id="price"></h2><br/>
		</div>
		<div class="layui-col-md3 layui-col-md-offset1">
			<h2 style="margin-bottom: 3%;">产品有问题？</h2>
			<button id="isback" class="layui-btn layui-btn-primary layui-border-blue"><i class="layui-icon">&#xe674;</i>申请召回</button>
		</div>
	</div>
</div>		
<script src="./lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="./js/my.js" charset="utf-8"></script>
<script>
	layui.use(['layer','carousel'], function () {
		var $ = layui.jquery,
		carousel = layui.carousel,
		layer = layui.layer;
		
		var produceID = GetQueryString("pid");
		$.ajax({
			url: globalAddress+"/product/getproduct/"+produceID,
			type: 'get',
			success:function(response){
				if(response.code==200){
					$("#pid").text(response.data.pid);
					$("#ptype").text(response.data.ptype);
					$("#pname").text(response.data.pname);
					$("#production").text(response.data.production);
					$("#destination").text(response.data.destination);
					$("#shipping").text(response.data.shipping);
					$("#receiving").text(response.data.receiving);
					$("#picking").text(response.data.picking);
					$("#validity").text(response.data.validity);
					$("#price").text(response.data.price);
				}else{
					alert("商品已不存在或已删除！");
				}
			},
			error:function(){
				alert("交互错误！");
			}			
		});
		$("#isback").click(function(){
			layer.open({
			  type: 2,
			  title: '召回单申请',
			  shadeClose: true,
			  shade: 0.4,
			  area: ['500px', '70%'],
			  content: './isback.html' //iframe的url
			}); 
		});	
		$("#register").click(function(){
			layer.open({
			  type: 2,
			  title: '加入我们',
			  shadeClose: true,
			  shade: 0.4,
			  area: ['500px', '60%'],
			  content: './register.html' //iframe的url
			}); 
		});
		//轮播图
		carousel.render({
		    elem: '#test1'
		    ,width: '100%' //设置容器宽度
		    ,arrow: 'always' //始终显示箭头
		    // ,anim: 'updown' //切换动画方式
		  });
		function GetQueryString(name) {
		     var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		     var r = window.location.search.substr(1).match(reg);
		     if (r != null)
		         return decodeURI(r[2]);
		     return null;
		}
	});
</script>
</body>
</html>
